/*
 * TMap Designer - A Thematic Map design software
 * Copyright (C) 2006 World Health Organization
 * http://www.who.int
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */
package who.tmap.imp;

import java.util.Collection;
import java.util.Map;
//import java.util.Set;

import who.tmap.bo.Attrs;
import who.tmap.common.TMapException;


/**
 * @author stl
 *
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public interface ImportAdapter {
 
	public static final String DS_TYPE ="dsType";
	public static final String FILE_NAME ="fileName";
	
    /**
     * Get adapter name
     * @return the name of the adapter
     */
    String getName();
    
    void configure( Map<String, String> config ) throws TMapException;
    
    /**
     * Open a connection to the datasource
     * @throws TMapException
     */
    void connect() throws TMapException;
    
    /**
     * Close the connection to the datasource
     * @throws TMapException
     */
    void disconnect() throws TMapException;
    
	/**
	 * Retrieve the fields information (name, type) for a selected table
	 * as a collection of AttrDef
	 * @return
	 * @throws TMapException
	 */
	@SuppressWarnings("unchecked")
	Collection readHeader() throws TMapException;

	/**
	 * Read data from the source
	 * @return
	 * @throws TMapException
	 */
	Attrs readValues() throws TMapException;
	
	/**
	 * Get a small set of data for UI representation
	 * @return
	 */
	Attrs readSampleData() throws TMapException;


}
